package base;


import java.net.MalformedURLException;
import java.net.URL;

import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.android.AndroidElement;

public class BaseDriver {
	public AndroidDriver<AndroidElement> driver=null;
	String urlStr="http://127.0.0.1:4723/wd/hub";
	@BeforeClass
	public void initApp() throws MalformedURLException {
		URL url= new URL(urlStr);
		DesiredCapabilities cap=new DesiredCapabilities();
		cap.setCapability("platformName", "Android");
		cap.setCapability("deviceName", "127.0.0.1:62001");
		cap.setCapability("noReset", "true");
		cap.setCapability("appPackage", "com.cnezsoft.xxm");//com.cnezsoft.xxm
		cap.setCapability("appActivity", ".MainActivity");
		driver=new AndroidDriver<AndroidElement>(url,cap);
	}
	/*
	@AfterMethod
	public void quit() {
		if (driver!=null) {
			driver.quit();
		}
	}
	*/
}
